package com.hospital.xiaochengxiu.yan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hospital.xiaochengxiu.yan.dao.DepartmentQueueMapper;
import com.hospital.xiaochengxiu.yan.entity.DepartmentQueue;
import com.hospital.xiaochengxiu.yan.service.DepartmentQueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author ：ysb
 * @ClassName ：DepartmentQueueServiceImpl
 * @Package ：com.hospital.xiaochengxiu.yan.service.impl
 * @Description:
 * @Date:2021/10/21 14:21
 */
@Service
public class DepartmentQueueServiceImpl implements DepartmentQueueService {

    @Autowired
    private DepartmentQueueMapper departmentQueueMapper;
    /**
     * 查询用户未缴费的ct记录
     * @param cardNo
     * @return
     */
    @Override
    public List<DepartmentQueue> selectDepartmentQueue(String cardNo) {
        QueryWrapper<DepartmentQueue> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("state",0)
                .eq("userId",cardNo)
                .groupBy("userTime")
                .orderByDesc("userTime");
        return departmentQueueMapper.selectList(queryWrapper);
    }
}
